from selenium import webdriver
import time
import os

driver = webdriver.Chrome()
url = "file:///" + os.path.abspath("C:\\课件\\我的课件\\测试\\selenium2/locateElement/selenium2html/checkbox.html")
driver.get(url)
time.sleep(3)
driver.maximize_window()
# 勾选里面所有的checkbox
# driver.find_element_by_id("c1").click()
# # driver.find_element_by_id("c2").click()
# # driver.find_element_by_id("c3").click()
# 定位一组tag name 都为input的元素
buttons = driver.find_elements_by_tag_name("input")
for button in buttons:
    if button.get_attribute('type') == 'checkbox':
        button.click()

time.sleep(6)
driver.quit()